package com.yuqiaotech.zcj.forum.model;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.Size;

import com.yuqiaotech.zcj.auth.model.User;


/**
 * 一个帖子。 Topic是一个话题，连同主帖，回帖，一起称为一个话题。
 * 
 * @author YUQIAOTECH
 * 
 */
@Entity
@Table(name="bbs_post")
public class Post {

	private long id;
	private String subject;
	private String text;
	private Topic topic;
	private Date postTime;
	private String addressDownload;
	private String nameDownload;
	private User creator;
	private int numPost;



	public int getNumPost() {
		return numPost;
	}

	public void setNumPost(int numPost) {
		this.numPost = numPost;
	}

	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="create_id")
	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public String getNameDownload() {
		return nameDownload;
	}

	public void setNameDownload(String nameDownload) {
		this.nameDownload = nameDownload;
	}

	public String getAddressDownload() {
		return addressDownload;
	}

	public void setAddressDownload(String addressDownload) {
		this.addressDownload = addressDownload;
	}


	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "topic_id")
	public Topic getTopic() {
		return topic;
	}

	public void setTopic(Topic topic) {
		this.topic = topic;
	}


	public Date getPostTime() {
		return postTime;
	}

	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}

	@Column(name = "post_txt", length = 10000)
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

}
